package com.ganzalang.gmall.interfacespecification.fifth.exception;

import com.ganzalang.gmall.interfacespecification.fifth.dto.response.ResultVO;
import com.ganzalang.gmall.interfacespecification.fourth.exception.APIException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @description:
 * @author: Ganzalang
 * @Date 2021/3/30 20:54
 */
@Slf4j
@RestControllerAdvice
public class ExceptionControllerAdvice {

    @ExceptionHandler(APIException.class)
    public ResultVO<String> handler(APIException e) {
        return new ResultVO<>(e.getCode(), "响应失败", e.getMsg());
    }
}
